package com.lovo.testjpa.service.impl;

import com.lovo.testjpa.bean.Role;
import com.lovo.testjpa.dao.RoleDAO;
import com.lovo.testjpa.dao.UserDAO;
import com.lovo.testjpa.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDAO roleDAO;
    @Autowired
    private UserDAO userDAO;
    @Override
    @Transactional
    public void delete(Integer id) {
        roleDAO.deleteUserRoleByRoleId(id);
        roleDAO.deleteById(id);
    }
}
